function submitForm() {
  if(validate() == true) {
    document.getElementById('registerId').submit();
  }
}

function validate123(obj) {
  var oHobbies = document.getElementsByName('hobbies[]');
  //alert(oHobbies.length)

  var count = 0;
  var minCheck = 2;

  for( i = 0; i < oHobbies.length; i++) {
    if(oHobbies[i].checked == true) {
      count++;
    }
  }

  if(count < minCheck) {
    alert("Please select atleast " + minCheck + " hobbies");
    return false;
  }
  return true;
}

function validate(obj) {
  var oUname = obj.uname;
  //alert(obj.uname.value)
  if(obj.uname.value == "") {
    alert("Name is Required");
    obj.uname.focus();
    return false;
  }

  if(obj.uname.value.length <= 5) {
    alert("Name should be 5 char long.");
    obj.uname.focus();
    obj.uname.select();
    return false;
  }
  /// By document name
  /*
   if(document.register.hiddenGender.value == ''){
   alert("Please select Gender 1");
   return false;
   }
   */
  /// By Object
  /*
   var oGender = obj.hiddenGender;
   if(oGender.value == ''){
   alert("Please select Gender 2");
   return false;
   }
   */

  if(document.getElementById('hiddenGenderId').value == '') {
    alert("Please select Gender 3");
    return false;
  }

  return true;
}
